package com.minjiang.system.service.sec.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.minjiang.model.vo.MyUserQueryVo;
import com.minjiang.model.system.MyUser;
import com.minjiang.system.service.sec.MyUserService;
import com.minjiang.system.mapper.sec.MyUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

/**
* @author Administrator
* @description 针对表【my_user(用户数据)】的数据库操作Service实现
* @createDate 2022-12-17 22:08:11
*/
@Service
public class MyUserServiceImpl extends ServiceImpl<MyUserMapper, MyUser>
    implements MyUserService{

    @Autowired
    private MyUserMapper myUserMapper;
    @Override
    public IPage<MyUser> selectPage(Page<MyUser> pageParam, MyUserQueryVo userQueryVo) {
        String title = userQueryVo.getKeyword();
        String createTimeBegin = userQueryVo.getCreateTimeBegin();
        String createTimeEnd = userQueryVo.getCreateTimeEnd();
        //封装参数
        QueryWrapper<MyUser> wrapper = new QueryWrapper<>();
        if(!StringUtils.isEmpty(title)) {
            wrapper.like("nickname",title).or().like("phone",title);
        }
        //调用mapper方法实现分页条件查询
        IPage<MyUser> myUserPage = myUserMapper.selectPage(pageParam, wrapper);
        return myUserPage;
    }
}




